package com.study.testSpringBoot.login;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @author wc_phz
 * @ClassName LoginController
 * @Description: [ ]
 * @date 2020/3/31 17:20
 */
@Controller
public class LoginController {

    @GetMapping("/login")
    public String login(){
        return "login";
    }

    @PostMapping("/login")
    public String login(String username, String password){
        if(LoginUtil.getLoginRecord(username, password)){
            LoginUtil.addLoginRecord(username, password);
            return "index";
        }else{
            return "error";
        }
    }
}
